package smb.controller;

import lombok.AllArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import smb.interceptor.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/user")
@AllArgsConstructor
public class UserController {

    @GetMapping("/info")
    public ResponseEntity<User> hello(HttpSession session) {
        return new ResponseEntity<>((User) session.getAttribute("user"), HttpStatus.OK);
    }
}
